package com.xzan.medusa.common.service;

import com.xzan.medusa.common.util.GsonUtils;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RabbitMqServiceImpl implements IRabbitMqService {
    @Autowired
    private AmqpTemplate rabbitTemplate;

    @Override
    public <T> void sendMessage(String queueName, T msg) {
        rabbitTemplate.convertAndSend(queueName, GsonUtils.toJsonString(msg));
    }

}

